package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface DishMapper {

    @AutoFill(OperationType.INSERT)
    void addDish(Dish dish);

    List<DishVO> page(DishPageQueryDTO dto);

    @Select("select * from dish where id = #{id}")
    Dish  selectById(Long id);

    void deleteDish(List<Long> ids);

    @AutoFill(OperationType.UPDATE)
    void updateDish(Dish dish1);

    List<DishVO> listDish(Long categoryId);


    @AutoFill(OperationType.UPDATE)
    @Update("update dish set status = #{status} , update_time = #{updateTime} , update_user = #{updateUser} where id = #{id}")
    void updateDishStatus(Dish dish);

    List<Dish> list(Dish dish);

    Integer countByMap(Map map);
}
